<?php

namespace Model;
use Think\Model;


class RoleModel extends Model{
    function saveAuth($roleid,$authid) {
        $authids= implode(',',$authid);
        dump($authids);

        $authinfo=D('Auth')->select($authids);
        $s="";

        foreach ($authinfo as $k => $v){
            if (!empty($v['auth_a'])&&(!empty($v['auth_c'])))
            $s .=$v['auth_c']."-".$v['auth_a'].",";
        }
        $s=trim($s,',');

        $sql="update sw_role set role_auth_ids='$authids',role_auth_ac='$s' WHERE role_id='$roleid'";
        return $this->execute($sql);    
    }
}